# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: James An <james@jamesan.ca>
# Contributor: Daniel Nagy <danielnagy at gmx de>

pkgname=libde265
pkgver=1.0.3
pkgrel=1
pkgdesc="Open h.265 video codec implementation"
arch=(x86_64)
url="https://github.com/strukturag/libde265"
license=(LGPL3)
depends=(gcc-libs)
makedepends=(ffmpeg sdl qt5-base)
optdepends=('ffmpeg: for sherlock265' 'qt5-base: for sherlock265'
            'sdl: dec265 YUV overlay output')
source=(https://github.com/strukturag/libde265/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz
        libde265-ffmpeg4.patch::"https://github.com/strukturag/libde265/commit/e5b8e2e7.patch")
sha256sums=('e4206185a7c67d3b797d6537df8dcaa6e5fd5a5f93bd14e65a755c33cd645f7a'
            'ba043c3ab34d93818d368f703926b8e4d4b822168d2236d2685458a40f70645b')

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../libde265-ffmpeg4.patch # Fix build with ffmpeg 4.0
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr --enable-static=no
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
